<#-- 全局变量 -->
	<#global ctx="${(ctp.contextPath)!''}">
        <#macro head>
        <meta http-equiv ="proma" content = "no-cache"/>
        <meta http-equiv="cache-control" content="no cache" />
        <meta http-equiv="expires" content="0" />
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<meta http-equiv="X-UA-Compatible" content="chrome=IE8">
			<link rel="icon" href="${ctx}/favicon.ico" mce_href="${ctx}/favicon.ico" type="image/x-icon">
            <link rel="shortcut icon" href="${ctx}/favicon.ico" mce_href="${ctx}/favicon.ico" type="image/x-icon">

            <script type="text/javascript">
                var ctx="${ctx}";
                var resPath="${resPath}";
			</script>
			<link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/iconfont.css?v=${version}"/>
			<link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/easyui.css?v=${version}" id="cssLink"/>
			<link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/base.css?v=${version}" />

			<script type="text/javascript" charset="utf-8" src="${resPath}/easyui/jquery.min.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" src="${resPath}/easyui/jquery.easyui.min.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" src="${resPath}/easyui/locale/easyui-lang-zh_CN.js?v=${version}"></script>
			<!-- jBox -->
			<link rel="stylesheet" type="text/css"  href="${resPath}/easyui/jbox/jBox.css?v=${version}" />
			<script type="text/javascript" charset="utf-8" src="${resPath}/easyui/jbox/jBox.min.js?v=${version}"> </script>

			<script type="text/javascript" charset="utf-8" src="${resPath}/js/formatDate.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" src="${resPath}/js/jquery.form.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" src="${resPath}/js/jquery.serializejson.js?v=${version}"></script>
			<!-- common -->
            <script type="text/javascript" charset="utf-8" src="${resPath}/js/common.js?v=${version}"></script>
            
			<script type="text/javascript" charset="utf-8" data-url="${resPath}/js/qrcode.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" data-url="${resPath}/easyui/src/biz.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" data-url="${resPath}/easyui/src/popeasyui_out_iframe.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" data-url="${resPath}/easyui/src/jquery.yearmothbox.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" data-url="${resPath}/js/extplug/jquery.datagridext.js?v=${version}"></script>

			<!-- <script src='http://www.cddyys.com:8000/CLodopfuncs.js'></script> -->
			<script src='http://127.0.0.1:8000/CLodopfuncs.js'></script>
			<script type="text/javascript" charset="utf-8" src="${resPath}/My97DatePicker/WdatePicker.js?v=${version}"></script>
			<script type="text/javascript" charset="utf-8" src="${resPath}/My97DatePicker/jquery.my97.js?v=${version}"></script>
            <script type="text/javascript" src="${ctx}/mes/js/common_print/DetailPrint.js?v=${version}"></script>
            <script type="text/javascript" src="${ctx}/mes/js/common/common.js?v=${version}"></script>

			<link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/bnthover.css?v=${version}" />
			<style>
                .shoucangMenu_a{
                    height: 100%;
                    width: 100%;
                    display: inline-block;
                    padding-right:25px
                }
		#top-menu{
            top:40px;
			font-size:16px;
		    position: absolute;
		    bottom: 0;
            z-index: 1000;
        }
        #top-menu #menu-content{
            top:10px;
        }
        .nav_top{
            height:40px;
            font-size:15px;
            background-color: #1c7bef;
        }
        .navBar .nav .mainMenu{
            height:45px;
            line-height: 45px;
        }
        
        .nav_list{
            display: inline-block;
            line-height: 39px;
            padding:0 15px;
			height:40px;
            color:#fff;
            position: relative;
            cursor: pointer;
			 float:left;
        }
        .nav_list i{
            margin-right:8px;
            font-size:16px;
        }
        .splitter{
            width: 1px;
            top:0px;
            margin-top:6px;
            margin-bottom:6px;
            right: 32px;
            height: 28px;
            position: absolute;
            display: inline-block;
            background:#666;
            border-right: 1px solid #ccc;
        }
        .blue_lj{
	        position: absolute;
	        height: 100%;
	        top: 8px;
	        right: 1px;
	        cursor: pointer;
	        width: 30px;
	    }
        .sn_logo{
            display: inline-block;
            width:107px;
            height:40px;
            background:url('${resPath}/images/logo_01.png') no-repeat 0 4px;
            vertical-align: middle;
            margin-left:16px;
			 float:left;
        }
        .nav_left{
            list-style:none;
            float:right;
            color:#fff;
        }
        .nav_left li{
            float:left;
            line-height:40px;
            text-align: center;
        }
        .nav_left li b{
            float:left;
            height:40px;
            width:1px;
            background-image: linear-gradient(#1c7bef, rgba(51, 78, 51, 0.5),#1c7bef);
        }
        .datagrid-cell-c1-active a{
            color:orange!important;
        }
        .nav_left li a{
            color:#fff;
        }
        .nav_left li i{
            float:left;
            padding:0 15px;
            cursor: pointer;
        }
        .nav_left li:hover{
            background:#1264c8;
        }
        .icon-shoucang1{
            color:#fab72a;
        }
        /*菜单显示*/
        .nav_list1{
            position: absolute;
            top:0;
            left:0;
            background:#272b2e;
            width:207px;
            height:100%;
            list-style: none;
            padding:15px 0;
        }
        .nav_list1 li{
            padding:8px 20px;
            color:#fff;
        }
        .shoucangMenu li{
            width:100%;
            color:#fff;
            font-weight: normal;
            box-sizing: border-box;
        }
        .nav_list_title li.active,.shoucangMenu li.active{
            background:#19539c;
        }
        .nav_list2{
            position: absolute;
            top:0;
            left:207px;
            right:0;
            width:817px;
            padding:15px 0;
            min-height:350px;
            background:#303538;
            text-align: center;
            color:#c8c8c8;
            margin:0;
            display:none;
        }
        .nav_list2_li a{
            color:#838486
        }
        .nav_list2_li:hover a{
            color:#fff;
        }
        /*.nav_list1 li:hover .nav_list2{*/
        /*display: block;*/
        /*}*/
        .nav_list2-title{
            color:#A6CEFF;
            float: left;
            width:140px;
            text-align: right;
            padding:9px 0;
        }
    

        .nav_list2-title span,.right_point{
            display: inline-block;
            border-right: 1px solid;
            border-bottom: 1px solid;
            width: 8px; height: 8px;
            transform: rotate(-45deg);
            margin:8px 0 0 10px;
            float:right;
        }

        .shoucangMenu .right_point{
            transform: rotate(135deg);
            float: none;
        }
		 .right_point{
             float:left;
            color:#a2b1ff;
            margin:16px 8px 0 0;
        }
        .nav_list2-title:hover{
            color:#fff;
        }
        .nav_list2-item{
            width: 100%;
            float: left;
            position: relative;
            clear:both;
        }
        .nav_list2_ul{
           margin-left:150px;
            width:750px;
        }
        .nav_list2_li{
            float:left;
            height:40px!important;
            width:200px;
            line-height: 40px;
            text-align: left;
            color:#fff;
        }
        .nav_lists{
            width:100%;
            height:100%;
            display: none;
        }
        
        .user{
             width: 50px;
             height: 50px;
             text-align: center;
             color: #FFFFFF;
             line-height: 50px;
         }
        .userMenu{
            position: absolute;
            right: 0;
            top:40px;
            background-color: #333;
            display: none;
        }
        .user:hover .userMenu{
            z-index: 600;
            font-weight: normal;
            text-align:left;
            padding:10px 10px;
            display: block;
        }
        .shoucang{
            width: 50px;
            height: 50px;
            text-align: center;
            color: #FFFFFF;
            line-height: 50px;
        }

        .shoucangMenu{
            position: absolute;
            right: 0;
            z-index: 600;
            display: none;
            top:40px;
            width:193px;
            background-color: #333;
        }
        .shoucangMenu li,.shoucangLi2 li{
            text-align: left;
            padding:0 10px;
            line-height:40px;
            height: 40px;
        }
        .shoucangMenu li{
            position: relative;
            text-align: center;
        }
        .shoucangLi2{
            position: absolute;
            top:0;
            left: -193px;
            width:193px;
            display: none;
            z-index: 600;
            background-color: #333;
        }
        .shoucangLi2 li{
            width:100%;
        }
		.location_1{
            float:left;
            color: #eaedfe;
            font-size:13px;
            line-height: 40px;
        }
        .msg-count{
            font-size: 12px;
		    color: #fff;
		    background-color: red;
		    float: left;
		    height: 15px;
		    position: absolute;
		    right: 243px;
		    top: 2px;
		    display: flex;
		    justify-content: center;
		    align-items: center;
        }
			</style>
			<script type="text/javascript">
				//获取浏览器页面可见高度和宽度
				var _PageHeight = document.documentElement.clientHeight;
				var _PageWidth = document.documentElement.clientWidth;
				//计算loading框距离顶部和左部的距离（loading框的宽度为215px，高度为61px）
				var _LoadingTop = 30;//_PageHeight > 61 ? (_PageHeight - 61) / 2 : 0;
				var _LoadingLeft = 20;//_PageWidth > 215 ? (_PageWidth - 215) / 2 : 0;
				//加载gif地址
				//var Loadimagerul="/Content/LoadJs/Image/loading.gif";
				//在页面未加载完毕之前显示的loading Html自定义内容
				var _LoadingHtml = '<div id="loadingDiv" style="position:absolute;left:0;width:100%;height:' 
				       + _PageHeight + 'px;top:0;background:#fff;opacity:1;filter:alpha(opacity=80);z-index:10000;">'
				       +'<div class="datagrid-mask-msg" style="border:none;font-size:14px; display:block; left: ' + _LoadingLeft + 'px; top:' + _LoadingTop + 'px; z-index:10001;">页面加载中,请稍后...</div></div>';
				//呈现loading效果
				document.write(_LoadingHtml);
				//监听加载状态改变
				document.onreadystatechange = completeLoading;
				//加载状态为complete时移除loading效果
				function completeLoading() {
				    if(document.readyState == "complete") {
				          var loadingMask = document.getElementById('loadingDiv');
				          loadingMask.parentNode.removeChild(loadingMask);
				    }
				}
				
			</script>
		</#macro>

		<#macro nav>
			<div class="nav_top">
			 <span class="sn_logo"></span>
			 <div class="nav_list"><i class="icon iconfont icon-mulu1"></i>导航</div>
			 <div class="location_1"><span class="right_point"></span><span class="location_c">首页</span>
			 <input type="hidden" id="currentMenuId" >
			 </div>
   
    <ul class="nav_left">
        <li>
            <b></b><a href="${ctx}/tasktracker/task"><i class="icon iconfont icon-renwu1" title="工作安排"></i><!--  <span class="msg-count">99</span>--></a>
        </li>
        <li>
            <b></b><a href="${ctx}/flow/task"><i class="icon iconfont icon-daiban" title="待办任务"></i></a>
        </li>
        <li>
            <b></b><a href="${ctx}/portal/home/welcome"><i class="icon iconfont icon-shouye1" title="首页"></i></a>
        </li>
        <li class="shoucang">
            <b></b><i id="shoucang" class="icon iconfont icon-shoucang3"></i>
            <ul class="shoucangMenu">

            </ul>

        </li>
        <li id="sys_help_url">
            
        </li>
        <li class="user">
            <b></b><i class="iconfont icon-yonghu-copy"></i>
            <div class="userMenu">
                <a href="javascript:void(0)" onclick="$('#edit-pwd-w').window('open');">修改密码</a>
                 <br/>
                <label>始终打开新页面 
                <input class="easyui-switchbutton s-btn b-btn-blue1" <#if (linkInNewTab)??>checked</#if> 
                	data-options="onText:'是',offText:'否',width:60,height:30,onChange:openNewWindow"></label>
                <br/>
                <span id="user-info" style="text-align: left;"></span>
            </div>
        </li>
        <li>
            <b></b><i class="icon iconfont icon-tuichu1" onclick="sysLogout()" title="安全退出"></i>
        </li>
    </ul>
</div>
<div id="top-menu">
    <div id="menu-content">
        <div class="directory">

        </div>
    </div>
    <div class="nav_lists">
        <div class="nav_list1">
            <ul class="nav_list_title">
                <li>
                     <span></span>
                </li>
            </ul>
        </div>
        <ul class="nav_list2">
            <li></li>
        </ul>
    </div>

</div>

<!--收藏菜单-->
<div id="coll-w" title="添加收藏">
    <form id="collectionMenuForm" method="post" novalidate="true">
        <input type="hidden" id="menu_id" name="id">
        <input type="hidden" id="menu_url" name="menuUrl">
        <table class="tableForm" style="padding-top: 18px;">
            <tr>
                <th>名称：</th>
                <td><input id="menu_name" name="menuName" type="text" maxlength="20" style="width: 180px;"
                    class="easyui-textbox" data-options="required:true,prompt:'请输入 ...'" /></td>
            </tr>
            <tr style="display:none;">
                <th>分组：</th>
                <td>
                    <input id="menu_pid" name="pid" class="easyui-combobox" data-options="
                         url: '${ctx}/security/desktop-menu/findUserMenuGroup',
                         prompt:'请选择...',panelHeight:140,
                         editable: false,
                         valueField: 'id',
                         textField: 'name',
                         loadFilter: function (data){
					        var node={name: '不分组',id:''};
                            data.unshift(node);
                            return data;
					    },
		                onLoadSuccess: function () {
		                  $(this).combobox('setValue', '');
		                }" style="width: 180px;" required="true"/>    
                </td>
            </tr>
        </table>
    </form>
</div>
<div id="menu-tt">
    <a href="javascript:void(0)" class="icon iconfont icon-caidan1" style="font-size: 18px;margin-right: 10px;" title="收藏管理" onclick="javascript:alert('功能完善中,敬请期待...')"></a>
</div>
<div id="menu-footer" style="padding:5px;text-align: center;">
    <a style="display:none;" id="addGroupBtn" class="easyui-linkbutton" iconCls="icon-add1" href="javascript:editGroup(0)">新建分组</a>
    <a id="collBtnEp" class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)">确定</a>
    <a style="display:none;" id="collBtnCancel" class="easyui-linkbutton" iconCls="icon-remove1" href="javascript:delMenu();">删除</a>
</div>

<!--修改密码窗口-->
<div id="edit-pwd-w" title="修改密码">
    <form id="editPwdForm" method="post" novalidate="true">
        <table class="tableForm">
            <tr>
                <th>旧密码：</th>
                <td><input id="txtOldPass" name="oldPwd" type="password" maxlength="18"
                    class="easyui-textbox" data-options="iconCls:'icon-lock',required:true,prompt:'请输入 ...'" /></td>
            </tr>
            <tr>
                <th>新密码：</th>
                <td><input id="txtNewPass" name="newPwd" type="password" maxlength="18"
                    class="easyui-textbox" data-options="iconCls:'icon-lock',required:true,prompt:'请输入 ...',validType:'length[4,16]'" /></td>
            </tr>
            <tr>
                <th>确认密码：</th>
                <td><input id="txtRePass" name="rePwd" type="password" maxlength="18"
                    class="easyui-textbox" data-options="iconCls:'icon-lock',required:true,prompt:'请输入 ...'" validType="equals['#txtNewPass']"/></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <a id="btnEp" class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)"> 确定</a>
                    <a id="btnCancel" class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)">取消</a>
                </td>
            </tr>
        </table>
    </form>
</div>

			<script>
			   var currentPageUrl = document.location.pathname;
			   var menuList;
               var hoverTimer;
			  function dataLoad(data,index){
					var childrenData = data[index].children;
					var _menuLevel2 = '';
					for (var j=0;j<childrenData.length;j++){
						_menuLevel2 += '<div class="nav_list2-item" flag="'+ index +'"><div class="nav_list2-title">'+childrenData[j].text+'<span></span></div>';
						_menuLevel2 +='<ul class="nav_list2_ul">';
						for (var k=0;k<childrenData[j].children.length;k++){
							if(childrenData[j].children[k].url && currentPageUrl.indexOf(childrenData[j].children[k].url)>=0){
                                var thisUrl=childrenData[j].children[k].url;
                                if(thisUrl.indexOf('work_plan_template')>=0){
                                    if(currentPageUrl.indexOf('work_plan_template_update')>=0 ){
                                        $(".location_c").html('定期工作模板变更')
                                    }else if(currentPageUrl.indexOf('work_plan_template_add')>=0){
                                        $(".location_c").html('定期工作模板申请')
                                    }else{
                                        $(".location_c").html('定期工作模板管理')
                                    }
                                }else{
                                    $(".location_c").html(childrenData[j].children[k].text)
                                }
                                $('#currentMenuId').val(childrenData[j].children[k].model.id);
							}
							var basePath = '${ctx}';
							if('${serverPath!}'!='' && childrenData[j].children[k].model.ifRemote==1){
								basePath = '${serverPath!}';
							}
							if('${clientPath!}'!='' && childrenData[j].children[k].model.ifRemote==0){
								basePath = '${clientPath!}';
							}
							if(childrenData[j].children[k].url.toLowerCase().indexOf("javascript")>=0||childrenData[j].children[k].url.toLowerCase().indexOf("http://")>=0){
								basePath = '';//当菜单中配置有http://代码时，去掉根路径
							}
							_menuLevel2 += '<li class="nav_list2_li"><a href="' + basePath + childrenData[j].children[k].url+'"';
							if(childrenData[j].children[k].url.toLowerCase().indexOf("http://")>=0){
								_menuLevel2 += ' target="_blank"';
							}
							
							<#if (linkInNewTab)??>_menuLevel2 += ' target="_blank"';</#if>
							
							_menuLevel2 += '>'+childrenData[j].children[k].text+'</a></li>';
						}
						_menuLevel2 +='</ul>';
						_menuLevel2 += '</div>'
					}
					return _menuLevel2
		    	}
			   $(function(){
                   getShouchang()
                    $(".nav_list").hover(function() {
			        $(".nav_list").css("background",'#1264c8');
			           $(".nav_lists").css('display','block');
			    },function(){
                    $(".nav_lists").css('display','none'); 
                
	             });
			        
                    $(".nav_lists").hover(function() {
                        $(".nav_list").css("background",'#1264c8');
			            $(".nav_lists").css('display','block');
			    },function(){
                
                    $(".nav_list").css("background",'#1c7bef');
			                $(".nav_lists").css('display','none');
                
	            });
			        $(document).on('mouseover', '.nav_list2-title', function () {
                            $(this).css('color','#fff');  
			        });
			        $(document).on('mouseover', '.nav_list2_ul', function () {
			            $(this).prev().css('color','#fff');
			        });
			        $(document).on('mouseout', '.nav_list2-title', function () {
			            $(this).css('color','#A6CEFF');
			        });
			        $(document).on('mouseout', '.nav_list2_ul', function () {
			            $(this).prev().css('color','#A6CEFF');
                    });
                    
                    $("#shoucang").hover(function() {//收藏夹
			       // $(".nav_list").css("background",'#1264c8');
			           $(".shoucangMenu").css('display','block');
			        },function(){
                  $(".shoucangMenu").css('display','none'); 
                
                 });
                 $(".shoucangMenu").hover(function() {//收藏夹
			       // $(".nav_list").css("background",'#1264c8');
			           $(".shoucangMenu").css('display','block');
			        },function(){
                 $(".shoucangMenu").css('display','none'); 
                
	             });

            
                    $.ajax({
			        url: '${ctx}/security/menu/getUserSysMenuList',
			        dataType: 'JSON',
			        type: 'POST',
			        success: function (data) {
			            var _level_1 = '';
			            for (var i=0;i<data.length;i++){
			                _level_1 += '<li>'+data[i].text+' <span></span></li>'
			            }
			            $('.nav_list_title').html(_level_1);
						var datas=[]
						for(var i=0;i<data.length;i++){
							datas[i]=dataLoad(data,i);
						}
                        $(".nav_list_title li ").hover(function() {
                            hoverTimer = setTimeout(() => {
                                $(this).addClass('active').siblings().removeClass('active');
                            $(".nav_list2").css('display','block')
							var index = $(this).index();
							$('.nav_list2').html(datas[index]);
                            }, 300);
                        },function(){
                            clearTimeout(hoverTimer);
	                });

	                    loadHelpPath();
			        }

			    });
              
		
               
			   });
		
               jQuery(function($) {
                    $('script[data-url]').each(function() {  
                    var _this = $(this),  
                        url = _this.attr('data-url');  
                    _this.attr('src',url);   
                });  
            }); 
			   var helpServerPath = '${helpServerPath!}';
			   //加载帮助文档地址
			   function loadHelpPath(){
				   
				   if(helpServerPath!=''){
					   $.ajax({
			                url: helpServerPath + '/helpdoc/sysDock/findByDockMenuId',
			                data: {dockMenuId: $('#currentMenuId').val()},
			                type: 'GET',
			                dataType:'JSONP',
			                jsonp:"callback",
			                jsonCallback:"jsoncallback",
			                //contentType: "application/text;utf-8", /*设置返回类型*/
			                success: function (result) {
			                	//if(result){
			                	//    var docPath = helpServerPath + result;
			                	//    $('#sys_help_url').html('<b></b><a href="'+docPath+'"><i class="icon iconfont icon-msnui-help-circle" title="帮助"></i></a>');
			                	//}
			                },error: function(XMLHttpRequest, textStatus, errorThrown) { 
			                	/* 扩展AJAX出现错误的提示 */
			                    //if(XMLHttpRequest.responseText.split('<script')[0]){//提示有值才弹出提示框
			                   //     $.messager.progress('close');
			                        //$.messager.alert('error', XMLHttpRequest.responseText.split('<script')[0]);
			                    //}
			                   
			                }
			            });
				   }
			   }
			   
			   function jsoncallback(result){
				   if(result){
                       var docPath = helpServerPath + result;
                       $('#sys_help_url').html('<b></b><a href="'+docPath+'" target="_blank"><i class="icon iconfont icon-msnui-help-circle" title="帮助"></i></a>');
                   }
			   }

                //返回桌面
                function returnCentrePage() {
                    window.location.href = ctx + "/portal";
                }
                //退出系统
                function sysLogout(){
                    $.messager.confirm('系统提示', '您确定要退出系统吗?', function(r) {
                        if (r) {
                            window.top.location.href = ctx + '/security/sso/logout';
                        }
                    });
                }

                // 判断各种浏览器全屏浏览的方法
                function launchFullScreen(element) {
                    if(element.requestFullscreen) {
                        element.requestFullscreen();
                    } else if(element.mozRequestFullScreen) {
                        element.mozRequestFullScreen();
                    } else if(element.webkitRequestFullscreen) {
                        element.webkitRequestFullscreen();
                    } else if(element.msRequestFullscreen) {
                        element.msRequestFullscreen();
                    }
                }
                // 判断浏览器全屏退出种类
                function exitFullscreen() {
                    if(document.exitFullscreen) {
                        document.exitFullscreen();
                    } else if(document.mozCancelFullScreen) {
                        document.mozCancelFullScreen();
                    } else if(document.webkitExitFullscreen) {
                        document.webkitExitFullscreen();
                    }
                }
                // 切换全屏
				$(document).on('click', '#toggleFullScreen', function () {
                    var flag = $(this).attr('flag');
                    if (flag === 'true'){
                        launchFullScreen(document.documentElement);
                        $(this).attr('flag', 'false');
                        $('.i_FullScreen').css('display', 'none');
                        $('.i_exitFull').css('display', 'block')
                    }else {
                        exitFullscreen();
                        $(this).attr('flag', 'true');
                        $('.i_FullScreen').css('display', 'block');
                        $('.i_exitFull').css('display', 'none')
                    }
                })
                
        $(function() {
        	loadUserInfo();
            if(currentPageUrl=='/flow/task'){
                $('#flow-task-url').addClass('active');
                $('#welcomeId').removeClass('active');
                $('#location').html('待办任务');
                currentPageUrl = '';
            }else{
                $('#flow-task-url').removeClass('active');
            }
            
            $('#shoucang').click(function() {
                $('#menu_name').textbox('setValue',$('title').html());
                $('#menu_url').val(window.location.href);
                $('#coll-w').window('open');
            })
            
            $('#collBtnEp').click(function() {
            	collMenu();
            })
            
            /* $('#collBtnCancel').click(function() {
                
            }) */
            
            $('#btnEp').click(function() {
                savePwd();
            })

            $('#btnCancel').click(function() {
                closePwd();
            })
            
            $('#coll-w').window({
                title : '添加到收藏',
                width: 320,
                height: 180,
                tools:'#menu-tt',
                footer: '#menu-footer',
                top: 40,
                left: $(window).width()-(320+140),
                modal: true,
                shadow: false,
                minimizable: false,
                maximizable: false,
                collapsible:false,
                closed: true,
                resizable:false
            });
            
            $('#edit-pwd-w').window({
                title : '修改密码',
                width: 320,
                height: 210,
                //top: 40,
                //left: $(window).width()-(320+140),
                modal: true,
                shadow: false,
                minimizable: false,
                maximizable: false,
                collapsible:false,
                closed: true,
                resizable:false
            });
            isCollectionMenu();
        });
		function openNewWindow(val) {
            console.log(val);
        /*     filterVal(val); */
         	var val;
            if(val==true){
                val = 1;//新页面打开
                
            }
            if(val==false){
                val = 0;//当前页面打开
               
            }
            $.ajax({
            url :  ctx+"/security/preference/switch/link_in_new_tab/"+val,
            type : 'post',
            success : function(data) {
            
               Msg.success(data+", 请重新登录使设置生效！");
            },
            error: function (response, ajaxOptions, thrownError) {
                Msg.error('操作失败');
                }
        })
        }

    function  filterVal(val) {
    	var val;
        if(val==true){
            val = 1;//新页面打开
            return val
        }
        if(val==false){
            val = 0;//当前页面打开
            return val
        }
      }       
        //加载用户信息
        function loadUserInfo(){
            $.get('${ctx}/security/user/getCurrentUserInfo?t='+Date.parse(new Date()),function(r){
                if(r){
                	var userInfo = '';
                    if(r.orgName){
                    	userInfo += '姓名：'+r.name + '<br/>工号：'+r.workno+'<br/>部门：'+r.orgName;
                    }else{
                        $('#user-info').hide();
                    }
                    
                    $('#user-info').append(userInfo);
                }
            });
        }
        function loadLocal(){
        	if(menuList){
        		var menu1 = '';
        		var menu2 = '';
        		var menu3 = '';
        		for(var i=0;i<menuList.length;i++){
        			menu1 = menuList[i].text;
        			var childrenData = menuList[i].children;
                    for (var j=0;j<childrenData.length;j++){
                    	menu2 = childrenData[j].text;
                        for (var k=0;k<childrenData[j].children.length;k++){
                            if(childrenData[j].children[k].url.indexOf(currentPageUrl)>=0){
                            	menu3 = childrenData[j].children[k].text;
                            	var menuId = childrenData[j].children[k].model.id;
                            	$('#location').html(menu1 +' 》'+ menu2 +' 》'+ menu3);
                            	return;
                            }
                        }
                    }
        		}
        	}
        }
        
        //判断是否收藏菜单
        function isCollectionMenu(){
        	$.get('${ctx}/security/desktop-menu/isCollectionMenu?url='+window.location.href+'&t='+Date.parse(new Date()),function(data){
                if(data){
                	$('#menu_id').val(data.id);
                	$('#menu_pid').combobox('setValue',data.pid);
                    $('#shoucang').removeClass('icon-shoucang3');
                    $('#shoucang').addClass('icon-shoucang1');
                    $('#coll-w').window('setTitle', '已添加到收藏');
                    $('#collBtnCancel').linkbutton('enable');
                    setTimeout(() => {
                $(".del_icon").click(function(){ 
                    var code = $(this).attr("id")
                  var eva = $(this);
                   	$.ajax({
                url : ctx+'/security/desktop-menu/delete/' +code,
                data : {},
                cache : false,
                success: function (result) {
                    // $('#coll-w').window('close');
                    eva.parent('li').remove();
                    Msg.success(result);
                    if(eva.attr("url").includes(window.location.pathname)){
                    $('#shoucang').removeClass('icon-shoucang1');
                    $('#shoucang').addClass('icon-shoucang3');
                    $('#coll-w').window('setTitle', '添加到收藏');
                    $('#collBtnCancel').linkbutton('disable');
                }

                }
            });
                                     })
            });
                }else{
                	$('#shoucang').removeClass('icon-shoucang1');
                    $('#shoucang').addClass('icon-shoucang3');
                    $('#coll-w').window('setTitle', '添加到收藏');
                    $('#collBtnCancel').linkbutton('disable');
                }
            });
      
        }
        
        //收藏菜单
        function collMenu(){
        	ajaxSubmitForm2("collectionMenuForm", ctx + '/security/desktop-menu/collectionMenu',function(result) {
        		$('#coll-w').window('close');
                Msg.success(result);//TODO
                   getShouchang();
                isCollectionMenu();
         
            });
        }
        //删除收藏菜单
        // function delMenu(){
        //     console.log($('#menu_id').val())
        	// $.ajax({
            //     url : ctx+'/security/desktop-menu/delete/' + $('#menu_id').val(),
            //     data : {},
            //     cache : false,
            //     success: function (result) {
            //     	$('#coll-w').window('close');
            //         Msg.success(result);
            //         isCollectionMenu();
            //     }
            // });
        // }
        
  
   
      //添加单据到批处理
        function editGroup(n) {
            var title = "添加分组";
            var url = '${ctx}/security/desktop-menu/addGroup';
            if(n==1){
                var node = $('#tt_desktop').tree('getSelected');
                title = "修改分组";
                url = '${ctx}/security/desktop-menu/editGroup?id='+node.id;
            }
            
            $("<div/>").dialog({
                id: "ui_group_add_dialog",
                href: url,
                title: title,
                width: 360,
                height: 140,
                top: ($(window).height() - 140) * 0.5,
                left: ($(window).width() - 360) * 0.5,
                modal: true,
                onClose: function(){
                    $("#ui_group_add_dialog").dialog('destroy'); //销毁dialog对象
                },
                onLoad: function(){
                },
                buttons: [{
                    id: 'stationDialogButton',
                    text: '确定',
                    position: 'center',
                    iconCls: 'icon-ok',
                    handler: function() {
                        ajaxSubmitForm2('editForm', '${ctx}/security/desktop-menu/updateGroup',
                            function(result){
                              $("#ui_group_add_dialog").dialog('destroy');
                              Msg.success(result);
                              $('#menu_pid').combobox('reload');
                        });
                    }
                },
                {
                    text: '关闭',
                    position: 'center',
                    iconCls: 'icon-cancel',
                    handler: function() {
                        $("#ui_group_add_dialog").dialog('destroy'); //销毁dialog对象
                        //$('#dg').datagrid('reload');
                    }
                }]
            });
        }
        
      //关闭登录窗口
        function closePwd() {
            $('#txtOldPass').textbox('setValue','');
            $('#txtNewPass').textbox('setValue','');
            $('#txtRePass').textbox('setValue','');
            $('#edit-pwd-w').window('close');
        }
    
        //修改密码
        function savePwd() {
            var $oldpass = $('#txtOldPass');
            var $newpass = $('#txtNewPass');
            var $rePass = $('#txtRePass');
            if(!$('#editPwdForm').form('validate')){
                return;
            }
            var data = form2Json('editPwdForm');
            $.post('${ctx}/security/user/updatepwd', data, function(result) {
                if (result.status == 0) {
                    $.messager.alert('系统提示', '恭喜，密码修改成功，请重新登录系统！', 'info',function(){
                        window.location.href="${ctx}/security/sso/logout";
                    });
                    $oldpass.textbox('setValue','');
                    $newpass.textbox('setValue','');
                    $rePass.textbox('setValue','');
                    $('#edit-pwd-w').window('close');
                }else{
                    Msg.error('错误', result.message);
                }
            });
        }

        /* $(function() {
            var serverPath = '${serverPath!}';
            var clientPath = '${clientPath!}';
            if(serverPath!=''){
                window.setInterval(sessionHold(serverPath),5*60*1000);
            }
            if(clientPath!=''){
                window.setInterval(sessionHold(clientPath),5*60*1000);
            }
            //会话保持
            window.setInterval(sessionHold(ctx),5*60*1000);
        }); */
        
        //会话保持
        /* function sessionHold(basePath){
            $.ajax({
                type:'GET',
                url: basePath + '/security/user/heartbeat?t='+Date.parse(new Date()),
                cache:false,
                error:function(){
                  //timeout = true;
                    //$.messager.confirm('错误','对不起，您已经与服务器断开了连接，请重新登录！',function(r){
                    //    top.window.location.href=ctx+'/login';
                    //});
                }
            });
        } */

//               $(document).on('mouseover', '.nav_list_title li', function () {
//                   $(this).addClass('active').siblings().removeClass('active');
//                   $(".nav_list2").css('display','block')
//                   var index = $(this).index();
//                   $('.nav_list2').html(datas[index]);
//
//               })

               var level2=[];
        function getShouchang(){
            $.ajax({
                url:ctx+'/security/desktop-menu/findUserMenu',
                success:function(data){
                    console
                    var level1=[];
                    var level1_='';
                    for(var i=0;i<data.length;i++){
                        var thisList=data[i];
                        if(thisList.children.length>0){
                            var thisChild=thisList.children;
                            var liHtml_='';
                            for(var j=0;j<thisChild.length;j++){
                             
                                liHtml_ +='<li class=""><a class="shoucangMenu_a" id="'+thisList.model.id+'" href="'+thisChild[j].model.menuUrl+'">'+thisChild[j].text+'</a><span class="splitter"></span><span url="'+thisChild[j].model.menuUrl+'" id="'+thisList.model.id+'"  class="del_icon l-btn-icon icon-remove blue_lj"></span></li>';
                            }
                            level2.push(liHtml_);
                          
                            level1_ +='<li class="shoucangLi">'+thisList.text+'<ul class="shoucangLi2">'+liHtml_+'</ul><span id="'+thisList.model.id+'"  url="'+thisList.model.menuUrl+'" class="del_icon l-btn-icon icon-remove blue_lj"></span></li>';
                            // level1_ +='<li class="shoucangLi"><span class="right_point"></span>'+thisList.text+'<ul class="shoucangLi2">'+liHtml_+'</ul></li>';
                        }else{
                            if(thisList.model.type == 0){
                            }else{
                                level1_ +='<li class="" style=""><a class="shoucangMenu_a"  href="'+thisList.model.menuUrl+'">'+thisList.text+'</a><span class="splitter"></span><span id="'+thisList.model.id+'" url=="'+thisList.model.menuUrl+'"  class="del_icon l-btn-icon icon-remove blue_lj"></span></li>';
                            }
                        }
                        level1.push(thisList);
                    }
                    $(".shoucangMenu").html(level1_)

                }
            })
        }

			</script>
		</#macro> 
		<#macro navNoMenu>
			<div class="nav_top">
				<span class="sn_logo"></span>
				<span id="order-title" style="padding-left: 30%;color: #fff;line-height: 39px;font-size: 18px;"></span>
				<ul class="nav_left">
				     <!--<li><b></b><i class="iconfont icon-dayin" onclick="printPage()" title="打印"></i></li>-->
				     <li><b></b><i class="iconfont icon-dayin" onclick="detailPrint(this,'orderType','orderId')" title="打印"></i></li>
					<li class="user"><b></b><i class="iconfont icon-yonghu-copy"></i>
						<div class="userMenu">
							<span id="user-info" style="text-align: left;"></span>
						</div></li>
				    <li><b></b><i class="icon iconfont icon-guanbi"
                        onclick="window.close()" title="关闭"></i></li>
				</ul>
			</div>
			<script>
			$(function() {
				$.get('${ctx}/security/user/getCurrentUserInfo?t='+Date.parse(new Date()),function(r){
	                if(r){
	                    var userInfo = '';
	                    if(r.orgName){
	                        userInfo += '姓名：'+r.name + '<br/>工号：'+r.workno+'<br/>部门：'+r.orgName;
	                    }else{
	                        $('#user-info').hide();
	                    }
	                    
	                    $('#user-info').append(userInfo);
	                }
	            });
			});
			</script>
		</#macro> 
		<#macro headView>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<meta http-equiv="X-UA-Compatible" content="chrome=IE8">
			<link rel="icon" href="${ctx}/favicon.ico" mce_href="${ctx}/favicon.ico" type="image/x-icon">
            <link rel="shortcut icon" href="${ctx}/favicon.ico" mce_href="${ctx}/favicon.ico" type="image/x-icon">
			<script type="text/javascript">
                var ctx="${ctx}";
                var resPath="${resPath}";
             </script>
             <link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/iconfont.css?v=${version}"/>
            <link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/easyui.css?v=${version}" id="cssLink"/>
            <link rel="stylesheet" type="text/css" href="${resPath}/easyui/themes/m-style/base.css?v=${version}" />

            <script type="text/javascript" charset="utf-8" src="${resPath}/easyui/jquery.min.js?v=${version}"></script>
            <script type="text/javascript" charset="utf-8" src="${resPath}/easyui/jquery.easyui.min.js?v=${version}"></script>
            <script type="text/javascript" charset="utf-8" src="${resPath}/easyui/locale/easyui-lang-zh_CN.js?v=${version}"></script>
            
            <script type="text/javascript" charset="utf-8" src="${resPath}/js/qrcode.js?v=${version}"></script>
             <!-- <script src='http://www.cddyys.com:8000/CLodopfuncs.js'></script> -->
            <script src='http://127.0.0.1:8000/CLodopfuncs.js'></script>
            <style type="text/css">
                body {
                    margin: 0px;
                }
                
                .print-page {
                    width: 100%;
                    font-size: 12px;
                    font-family: SimSun, "宋体";
                }
                
                .print-page div, .print-page span, .print-page th, .print-page td, .print-page label{
                    font-family: SimSun, "宋体";
                    font-size: 12px;
                    color: #000;
                }
                
                .print-page table {
                    width: 100%;
                    border-width: 1px;
                    border-color: #000;
                    border-collapse: collapse;
                }
                
                .print-page table th {
                    border-width: 1px;
                    padding: 4px;
                    border-style: solid;
                    border-color: #000;
                    width: 80px;
                }
                
                .print-page table td {
                    border-width: 1px;
                    padding: 4px;
                    border-style: solid;
                    border-color: #000;
                }
                
                .print-page .title{
		            font-weight: bold;
		            font-size: 14px;
		        }
                
                .view-page {
                    font-family: "Microsoft YaHei", "微软雅黑";
                    font-size: 14px;
                    color: #333;
                }
                
                .view-page div, .view-page span, .view-page th, .view-page td, .view-page label{
                    
                }
                
                .view-page table {
                    width: 100%;
                    border-width: 1px;
                    border-color: #ddd;
                    border-collapse: collapse;
                }
                
                .view-page table  th {
                    border-width: 1px;
                    padding: 8px;
                    border-style: solid;
                    border-color: #ddd;
                    color: #000;
                    background-color: #F8F9F9;
                    text-align: right;
                    width: 120px;
                }
                
                .view-page table td {
                    border-width: 1px;
                    padding: 8px;
                    border-style: solid;
                    border-color: #ddd;
                }
                
                .view-page .title{
		            background: #fff;
		            font-weight: bold;
		            font-size: 14px;
		            padding-left: 20px;
		            text-align: left;
		        }
            </style>
	    </#macro>
        
		<#macro foot>
		</#macro>